import cv2
import numpy as np

img = cv2.imread('circles.jpg')
o = img.copy()
o = cv2.medianBlur(o, 5)
gray = cv2.cvtColor(o, cv2.COLOR_BGR2GRAY)

circles = cv2.HoughCircles(gray, cv2.HOUGH_GRADIENT, 1, 70, param1=100,
                           param2=30, minRadius=10, maxRadius=60)
circles = np.uint(np.round(circles))
for c in circles[0]:
    x, y, r = c
    cv2.circle(img, (x, y), r, (0, 0, 255), 3)
    cv2.circle(img, (x, y), 2, (0, 0, 255), 3)

cv2.imshow('img', img)
cv2.waitKey()
cv2.destroyAllWindows()
